package com.second.mapper;

import com.second.model.pojo.FOrd;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface IFOrdMapper extends JpaRepository<FOrd,Long> {

        FOrd getByGoodsId(Integer goodid);

        FOrd getById(Integer id);

        List<FOrd> findByUserId(Integer userId);

        Optional<FOrd> findById(Integer Id);

        List<FOrd> getByOrdState(Integer ordState);


        List<FOrd> findAllByUserId(Integer userId);

        List<FOrd> findAllByUserIdAndOrdState(Integer userId,Integer status);

        //根据创建时间排序
        List<FOrd> findAllByUserIdAndOrdStateOrderByOrdCreateDateDesc(Integer userId,Integer status);

        //统计goods售出数量
        int countByGoodsId(Integer goodId);


        FOrd findByUserIdAndShopId(Integer userId,Integer shopId);
//        查询订单编号并支付
        FOrd findByOrdCodeAndOrdPrice(String orderCode,Integer ordPrice);

        FOrd findByOrdCode(String orderCode);

}
